import { UserModel } from "@/api/model/user.model.ts";

export default class HistoryUserStore {
    private userMap = new Map<number, UserModel>();

    add(user: UserModel) {
        this.userMap.set(user.id, user);
    }

    addAll(users: UserModel[] | IterableIterator<UserModel>) {
        for (let user of users) {
            this.add(user);
        }
    }

    get(id: number): UserModel | undefined {
        return this.userMap.get(id);
    }

    contains(id: number): boolean {
        return this.userMap.has(id);
    }

    clear() {
        this.userMap.clear();
    }

    size(): number {
        return this.userMap.size;
    }

}